<template>
    <div style="width: 100%; height: auto">
        <!-- 修改密码 -->
        <div style="border: 0px solid #f00; margin-top: 0.5%; border-radius: 25px; background-color: #fff">
            <div style="width: 98%; margin-left: 1%">
                <el-form :model="form" ref="form" label-width="20%" label-position="right" class="demo-ruleForm">
                    <el-row class="row_Css">
                        <el-col :span="24">
                            <el-form-item label="用户名" prop="roleName">
                                <el-input  v-model="form.userName" :disabled=true placeholder="" style="width: 50%"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="row_Css">
                        <el-col :span="24">
                            <el-form-item label="姓名" prop="roleName">
                                <el-input  :disabled=true v-model="form.name" placeholder="" style="width: 50%"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="row_Css">
                        <el-col :span="24">
                            <el-form-item label="原密码" prop="roleName">
                                <el-input type="password" class="input_row" v-model="form.ordPws" placeholder="" style="width: 50%"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="row_Css">
                        <el-col :span="24">
                            <el-form-item label="新密码" prop="roleName">
                                <el-input  type="password" class="input_row"  v-model="form.pwd" placeholder="" style="width: 50%"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="row_Css">
                        <el-col :span="24">
                            <el-form-item label="确认密码" prop="roleName">
                                <el-input  type="password" class="input_row" v-model="form.truepwd" placeholder="" style="width: 50%"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
        </div>
        <br />
        <div style="text-align: center">
            <el-image :src="submit_img" @click="updatePWD()" style="width: 150px; height: 60px"></el-image>
        </div>
    </div>
</template>
<script>

export default {
    data() {
        return {
            submit_img: require('../../assets/imgs/组 422.png'),
            labelPosition: 'right',
            form: {
                userName:'',
                name:'',
                ordPws:'',
                pwd:'',
                truepwd:'',
            }
        };
    },
    created() {
        let param=localStorage.getItem("jdGov");
        this.$post('/sysManage/user/personal?request='+param).then(res=>{
            this.form.userName=res.data.userName,
            this.form.name=res.data.name
        })
    },
    watch: {
    },
    methods: {
        updatePWD(){
            if(this.form.pwd!=this.form.truepwd){
                this.$message.error("新密码和旧密码不同，请重新输入")
            }
            let param={
                request:localStorage.getItem("jdGov"),
                pwd:this.form.pwd,
                ordPws:this.form.ordPws,
            }
            this.$post('/sysManage/user/updatePwd',param).then(res=>{
                if(res.code==2000){
                    this.$message.success("密码更新成功")
                }else{
                    this.$message.error(res.message)
                }
            })
            this.form.ordPws='',
            this.form.pwd='',
            this.form.truepwd=''
        }
    }
};
</script>
<style scoped>
/* 输入框样式 */
.el-input--small .el-input__inner {
    border: 0;
}
.input_css {
    border: 0;
}
.input_row{
    background: #f0f0f0;
    border: 1px solid #2e8ccc;
}
.el-textarea__inner {
    background: #f0f0f0;
    border: 1px solid #2e8ccc;
    height: 70px !important;
}
.fontStyle {
    font-size: 20px;
    font-family: '微软雅黑';
    color: #2e8ccc;
    font-weight: 600;
}
.el-divider--horizontal {
    margin: 10px 0;
    background-color: #2e8ccc;
    height: 2px;
}
.row_Css {
    font-size: 18px;
    font-family: '微软雅黑';
    color: #000;
    font-weight: 600;
}
.el-form-item__label{
    border: 1px solid #000000;
    background: greenyellow;
    padding: 0.5%;
}
.el-form-item__content{
    padding: 0.5% 0.5% 0% 0%;
    border: 1px solid #000;
}
</style>
